package GameElements;

import java.awt.Color;
import java.util.Vector;

public class PawnFactory 
{
	private static final PawnFactory instance = new PawnFactory();
	public static final Color[] Couleur  = {Color.green, Color.red, Color.blue, Color.yellow, Color.black, Color.gray};
	public static final String[] ColorStr = {"green", "red", "blue", "yellow", "black", "gray"};
	
	private PawnFactory(){}
    
	public final static PawnFactory getInstance() 
	{
		return instance;
	}
	
	public Vector<Pawn> createPawn(String type, int indexPlayer, int quantite)
	{
		if(quantite <= 0)
		{
			System.out.println("erreur : la quantité doit etre >0");
			return null;
		}
		else
		{
			Vector<Pawn> pions = new Vector<Pawn>();
			if(type.equals("basic"))
			{
				String imgPath = "img/pawns/";
				for(int i=0; i<quantite; i++)
					pions.add(new BasicPawn(imgPath+ColorStr[indexPlayer]+"_basic.png", Couleur[indexPlayer]));	
			}
			else if(type.equals("special"))
			{
				String imgPath = "img/pawns/special/";
				for(int i=0; i<quantite; i++)
					pions.add(new PionSpecial(imgPath+ColorStr[indexPlayer]+"_special.png", Couleur[indexPlayer]));
			}
			return pions;
		}
	}
}
